package com.zhongyu.item.consumer;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.RedisSerializer;
import org.springframework.data.redis.serializer.StringRedisSerializer;

import javax.annotation.Resource;

@Configuration
public class RedisConfig {
@Resource
    private  RedisTemplate<String,Object> redisTemplate;
    @Bean("myRedisTemplate")
public RedisTemplate <String,Object>myRedisTemplate(){
        RedisSerializer stringSerializer = new StringRedisSerializer();
        redisTemplate.setKeySerializer(stringSerializer);
        redisTemplate.setHashKeySerializer(stringSerializer);
   //     redisTemplate.setValueSerializer(stringSerializer);
        return  redisTemplate;
}
}
